<template>
    <div id="app">
        <header-vue></header-vue>
        <keep-alive exclude="InsuranceDetails, ReportDetails">
            <router-view></router-view>
        </keep-alive>
        <footer-vue></footer-vue>
    </div>
</template>

<script>
    import FooterVue from "./components/content/FooterVue"
    import HeaderVue from "./components/content/HeaderVue"

    export default {
        name: 'App',
        components: {
            FooterVue,
            HeaderVue
        },
      created() {
          //在页面加载时读取sessionStorage里的状态信息
            if (sessionStorage.getItem("state") ) {
                this.$store.commit('userStatusSessionStorage', this.$qs.parse(sessionStorage.getItem("state")));
            }
      },
      mounted() {
         // sessionStorage必须以字符串的形式存储
            //在页面刷新时将信息保存到sessionStorage里
            window.addEventListener("beforeunload", () => {
              sessionStorage.setItem("state", this.$qs.stringify(this.$store.state));  // stringify转为字符串
            })
      }
    }
</script>

<style>
    /*global style*/
    @import "assets/css/base.css";

    #app {
        font-family: Avenir, Helvetica, Arial, sans-serif;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        /*text-align: center;*/
        color: #2c3e50;
        margin: 0;
    }
</style>
